//
//  ViewController.m
//  QRCode
//
//  Created by tgs on 2017/7/6.
//  Copyright © 2017年 tgs. All rights reserved.
//

#import "ViewController.h"
#import "QRViewController.h"

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 100, self.view.bounds.size.width-200, 60);
    [btn setTitle:@"扫描二维码" forState:0];
    [btn setTitleColor:[UIColor blueColor] forState:0];
    btn.backgroundColor = [UIColor grayColor];
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}

- (void)btnClick{
    QRViewController *qrVC = [[QRViewController alloc] init];
    [self.navigationController pushViewController:qrVC animated:YES];
    qrVC.block = ^(NSString *qrStr){
        NSLog(@"viewController qrStr:%@",qrStr);
    };
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
